{smcl}
{* 01Nov2002}{...}
{hline}
{hi:help ivendog} {right:(SJ7-4: st0030_3; SJ5-4: st0030_2;}
{right:SJ4-2: st0030_1; SJ3-1: st0030)}
{hline}

{title:Title}

{p2colset 5 16 18 2}{...}
{p2col:{hi:ivendog} {hline 2}}Calculate Durbin-Wu-Hausman endogeneity test after ivregress or ivreg2{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 14 2}{cmd:ivendog} [{it:varlist}]

{p 8 8 2} {cmd:ivendog} is for use after {cmd:ivregress} or {cmd:ivreg2};
see {helpb ivregress} or {helpb ivreg2} (if installed).
The test is not valid with {cmd:pweight}s or the {cmd:robust} or
{cmd:cluster()} options of the original estimator and will not be performed in
these circumstances.


{title:Description}

{p 4 4 2}{cmd:ivendog} computes a test for endogeneity in a regression
estimated with instrumental variables (IV). The null hypothesis for which
states that an ordinary least squares (OLS) estimator of the same equation
would yield consistent estimates; that is, any endogeneity among the
regressors would not have deleterious effects on OLS estimates. A rejection of
the null indicates that endogenous regressors' effects on the estimates are
meaningful, and IV techniques are required. The test was
first proposed by Durbin (1954) and separately by Wu (1973; a T4 statistic)
and Hausman (1978). This Durbin-Wu-Hausman (DWH) test is numerically
equivalent to the standard Hausman test obtained by using {helpb hausman} with
the {cmd:sigmamore} option, in which both forms of the model must be fitted.
Under the null, it is distributed chi-squared with m degrees of freedom, where
m is the number of regressors specified as endogenous in the original
IV regression.

{p 4 4 2}The {cmd:ivendog} output also contains the
Wu-Hausman T2 statistic of Wu (1973). Hausman (1978) showed that the test
could be calculated straightforwardly through the use of auxiliary
regressions.  The test statistic, under the null, is distributed F(m,N-k),
where m is the number of regressors specified as endogenous in the original
IV regression. A rejection indicates that the IV estimator should be used.
See Davidson and MacKinnon (1993, 237-240) and Wooldridge (2000, 483-484). 

{p 4 4 2}If the constant was excluded from {cmd:ivregress} or {cmd:ivreg2}, it
will be excluded from the auxiliary regression.

{p 4 4 2}As Davidson and MacKinnon (1993, 241-242) discuss, the test may be
applied to a subset of the endogenous variables, maintaining those not
specified as endogenous. In this form, the {it:varlist} contains those
variables that are to be tested, and the degrees of freedom for the test
refer to the number of variables listed.

{p 4 4 2}These tests may also be computed by the {cmd:orthog()} option of
{cmd:ivreg2}.  Although {cmd:ivendog} may not be applied to robust nor cluster
estimates, {cmd:ivreg2} may also be used to perform a
heteroskedasticity-robust form of the test in either context, as well as in
the GMM context.

{p 4 4 2}The underlying computations for these tests are described in much
greater detail in Baum, Schaffer, and Stillman (2003).


{title:Examples}

{p 4 8 2}{cmd:. use http://fmwww.bc.edu/ec-p/data/wooldridge/mroz, clear}{p_end}
{p 4 8 2}{cmd:. ivregress lwage exper expersq (educ = motheduc fatheduc)}{p_end}
{p 4 8 2}{cmd:. ivendog}{p_end}

{p 4 8 2}{cmd:. ivregress lwage (exper educ = motheduc fatheduc huseduc)}{p_end}
{p 4 8 2}{cmd:. ivendog}{p_end}
{p 4 8 2}{cmd:. ivendog exper}{p_end}


{title:References}

{p 4 8 2}Baum, C. F., M. E. Schaffer, and S. Stillman. 2003.
Instrumental variables and GMM: Estimation and testing.
{it:Stata Journal} 3: 1-31.

{p 4 8 2}Davidson, R., and J. G. MacKinnon. 1993. {it:Estimation and}
{it:Inference in Econometrics}. 
New York: Oxford University Press.

{p 4 8 2}Durbin, J. 1954. Errors in variables.
{it:Review of the International Statistical Institute} 22: 23-32.

{p 4 8 2}Hausman, J. 1978. Specification tests in econometrics.
{it:Econometrica} 46: 1251-1271.
        
{p 4 8 2}Wooldridge, J. 2002. 
{it:Introductory Econometrics: A Modern Approach}. 2nd ed.
New York: South-Western College Publishing.

{p 4 8 2}Wu, D.-M. 1973. Alternative tests of independence between stochastic
regressors and disturbances. {it:Econometrica} 41: 733-750.

        
{title:Acknowledgments}

{p 4 4 2}We are grateful to Ronna Cong, Vince Wiggins, David Drukker, and an
anonymous reviewer for critical review of this module.  Errors remaining are
our own.


{title:Authors}

        Christopher F Baum, Boston College, USA
        baum@bc.edu

        Mark E. Schaffer, Heriot-Watt University, UK
        M.E.Schaffer@hw.ac.uk
        
        Steven Stillman, New Zealand Department of Labour
        Steven.Stillman@lmpg.dol.govt.nz
		

{title:Also see}

{psee}Manual:  {hi:[R] ivregress}, {hi:[R] hausman}{p_end}

{psee}Online:  {helpb ivregress}, {helpb ivreg2} (if installed);
{helpb hausman}
{p_end}
